export function isObject(target) {
    return typeof target === 'object' && target !== null
}

export function isArray(target) {
    return Array.isArray(target)
}

export function hasChanged(oldValue, value) {
    return (oldValue !== value && !(Number.isNaN(oldValue) && Number.isNaN(value)))
}

export function isFunction(value) {
    return typeof value === 'function';
}

export function isString(target) {
    return typeof target === 'string'
}

export function isNumber(target) {
    return typeof target === 'number'
}

export function isBoolean(target) {
    return typeof target === 'boolean'
}

// 驼峰化
export function camelize(str) {
    // my-first-name
    // myFirstName
    return str.replace(/-(\w)/g, (_, c) => (c ? c.toUpperCase() : ''))
}

// 首字母大写
export function capitalize(str) {
    return str[0].toUpperCase() + str.slice(1)
}